<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib uri="/WEB-INF/tld/pageutil.tld" prefix="pu"%>
<%@taglib uri="/WEB-INF/tld/pageable.tld" prefix="pageable"%>
<%@taglib uri="http://java.sun.com/jstl/core" prefix="c"%>
<%@taglib uri="http://java.sun.com/jstl/core_rt" prefix="c-rt"%>
<%@taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt-rt"%>
<script>
function addColumn(){
	document.formForm.action="/ecadmin/form/addColumn.do";
	document.formForm.submit();
}
$(function(){
	$('#submitForm').click(function(){
		error="";
		if(document.formForm.name.value==''){
			error+="名称为必填\r\n";
		}
		if(document.formForm.description.value==''){
			error+="描述为必填\r\n";
		}
		
		if(error!=''){
			alert(error);
		}else{
			document.formForm.submit();
		}
	});

	$('#createQt').click(function(){
		location.href='/ecadmin/workOrder/listWorkOrderType.do';
	});
});
</script>

<style>
<!--
.tb-2{border:1px solid #ccc; width:100%; vertical-align:text-bottom;}
.tb-2 th{background:#ffe9b5; color:#631;text-align:center; font-weight:bold; font-size:13px; padding:.25em;*padding:.35em .2em .15em;vertical-align:middle}
.tb-2 td{padding:6px 5px;*padding:6px 5px 4px;text-align:center;}

.tb-2 td {
text-align:left;
}
.tb-2 tr:hover{background:#fffae5;}
-->
</style>
<h1>工单类型管理

</h1>
${message }
<table class="tb-2">
<tr><td align="left"><input type="button" value="建立工单类型" id="createQt"/></td></tr>
</table>
<br/>
<table>
<tr>
<td valign="top">
<form name="selectForm" method="get" action="/ecadmin/workOrder/getWorkOrderType.do">
<select name="questionType"  multiple="multiple" size="35" onchange="document.selectForm.submit()">
<c-rt:forEach items="${questionTypes }" var="qt">
<option value="${qt.name }" <c-rt:if test="${param.questionType==qt.name }">selected="selected"</c-rt:if>>${qt.description }</option>
</c-rt:forEach>
</select>
</form>
</td><td valign="top">
<form name="formForm" method="post" action="/ecadmin/workOrder/updateWorkOrderType.do">
	
		<table class="tb-2" id="theTable">
				<tr>
					<th>名称</th><td valign="top"><input type="text" name="name" value="${theQuestionType.name }" size="8"/></td>
				</tr>
				<tr>	
					<th>描述</th><td valign="top"><input type="text" name="description" value="${theQuestionType.description }" size="8"/></td>
				</tr>
				<tr>
					<th>表单名称</th><td>
					<select name="formName">
						${pu:reqSet('forms', pu:queryByHql('from Form order by name asc', null, null)) }
						<c-rt:forEach items="${forms }" var="aForm">
							<option value="${aForm.name }" <c-rt:if test="${aForm.name==theQuestionType.extraAttr.name }">selected="selected"</c-rt:if>>${aForm.description }</option>
						</c-rt:forEach>
					</select>
					</td>
				</tr>
				<tr>
					<th>流程名称</th>
					<td>
					<select name="workFlowName">
						<option value="">请选择</option>
						${pu:reqSet('workFlows', pu:queryByHql('from WorkFlow order by name asc', null,null)) }
						<c-rt:forEach items="${workFlows }" var="wf">
							<option value="${wf.name }" <c-rt:if test="${wf.name==theQuestionType.workFlowName }">selected="selected"</c-rt:if>>${wf.description }</option>
						</c-rt:forEach>
					</select>
					</td>
				</tr>
				<tr>
					<th>是否需要工单</th><td><input type="radio" value="true" name="needWorkOrder" <c-rt:if test="${empty theQuestionType || theQuestionType.needWorkOrder!='false' }">checked="checked"</c-rt:if>/>需要<input type="radio" value="false" name="needWorkOrder" <c-rt:if test="${theQuestionType.needWorkOrder=='false' }">checked="checked"</c-rt:if>/>不需要</td>
				</tr>
				<tr>
					<th>是否需要回答客人</th><td><input type="radio" value="true" name="needAnswer" <c-rt:if test="${empty theQuestionType || theQuestionType.needAnswer!='false' }">checked="checked"</c-rt:if>/>需要<input type="radio" value="false" name="needAnswer" <c-rt:if test="${theQuestionType.needAnswer=='false' }">checked="checked"</c-rt:if>/>不需要</td>
				</tr>
				</tr>

		</table>
	
	<table class="tb-2">
	<tr><td align="left"><input type="button" id="submitForm" value="送出"/><input type="reset" id="resetForm" value="重置"/></td></tr>
	</table>
	</form>
</td>
</tr>
</table>
<table style="display:none">
<tbody id="tempTr">

</tbody>
</table>